<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>复杂系统故障诊断平台 - 故障诊断与定位</title>
    <!-- Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <!-- 自定义样式 -->
    <style>
        :root {
            --primary-color: #3949ab;
            --primary-light: #e8eaf6;
            --secondary-color: #00acc1;
            --dark-color: #37474f;
            --light-color: #f5f7fa;
            --border-radius: 8px;
            --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background-color: #f8f9fa;
            color: #333;
        }

        .sidebar {
            min-height: 100vh;
            background-color: var(--dark-color);
            padding-top: 20px;
            box-shadow: var(--shadow);
        }

        .sidebar h4 {
            color: white;
            font-weight: 600;
        }

        .main-content {
            padding: 20px;
        }

        .nav-link {
            color: #e0e0e0;
            border-radius: var(--border-radius);
            margin: 5px 0;
            transition: all 0.3s;
        }

        .nav-link:hover {
            background-color: rgba(255, 255, 255, 0.1);
            color: white;
        }

        .nav-link.active {
            background-color: var(--primary-color);
            color: white;
            font-weight: 500;
        }

        .card {
            border-radius: var(--border-radius);
            box-shadow: var(--shadow);
            border: none;
            overflow: hidden;
            margin-bottom: 20px;
        }

        .card-header {
            background-color: white;
            border-bottom: 1px solid #eee;
            font-weight: 600;
            padding: 12px 16px;
        }

        .btn {
            border-radius: var(--border-radius);
            padding: 6px 16px;
            font-weight: 500;
        }

        .btn-outline-primary {
            color: var(--primary-color);
            border-color: var(--primary-color);
        }

        .btn-outline-primary:hover {
            background-color: var(--primary-color);
            color: white;
        }

        .btn-primary {
            background-color: var(--primary-color);
            border-color: var(--primary-color);
        }

        .btn-primary:hover {
            background-color: #303f9f;
            border-color: #303f9f;
        }

        .btn-outline-secondary {
            color: var(--dark-color);
            border-color: #ddd;
        }

        .btn-outline-secondary:hover {
            background-color: #e0e0e0;
            color: var(--dark-color);
            border-color: #ddd;
        }

        .diagnosis-chart {
            height: 400px;
            background-color: var(--light-color);
            border-radius: var(--border-radius);
            margin-bottom: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            border: 1px dashed #ddd;
        }

        .status-badge {
            font-size: 0.9em;
            padding: 0.5em 1em;
            border-radius: 20px;
        }

        /* 导航标签样式 */
        .nav-tabs {
            border-bottom: 2px solid #eee;
        }

        .nav-tabs .nav-link {
            color: #666;
            border: none;
            padding: 12px 16px;
            margin-right: 4px;
            border-radius: var(--border-radius) var(--border-radius) 0 0;
            transition: all 0.3s;
        }

        .nav-tabs .nav-link:hover {
            color: var(--primary-color);
            background-color: rgba(57, 73, 171, 0.05);
        }

        .nav-tabs .nav-link.active {
            color: var(--primary-color);
            background-color: white;
            font-weight: 500;
            border-bottom: 2px solid var(--primary-color);
        }

        /* 表单元素样式 */
        .form-label {
            font-weight: 500;
            color: #333;
        }

        .form-control,
        .form-select {
            border-radius: var(--border-radius);
            padding: 8px 12px;
            border: 1px solid #ddd;
        }

        .form-control:focus,
        .form-select:focus {
            border-color: var(--primary-color);
            box-shadow: 0 0 0 2px rgba(57, 73, 171, 0.25);
            outline: none;
        }

        .table {
            vertical-align: middle;
        }

        .bg-danger {
            background-color: #f44336 !important;
        }

        .bg-warning {
            background-color: #ff9800 !important;
        }

        .bg-success {
            background-color: #4caf50 !important;
        }

        .alert-info {
            background-color: var(--primary-light);
            color: var(--primary-color);
            border: none;
            border-radius: var(--border-radius);
        }

        .list-group-item {
            border-radius: var(--border-radius);
            margin-bottom: 8px;
            border: 1px solid #eee;
        }
    </style>
</head>

<body>
    <div class="container-fluid">
        <div class="row">
            <!-- 侧边栏 -->
            <div class="col-md-2 sidebar">
                <h4 class="text-center mb-4">故障诊断平台</h4>
                <nav class="nav flex-column">
                    <a class="nav-link" href="index.html"><i class="fas fa-database me-2"></i>诊断知识管理</a>
                    <a class="nav-link" href="signal-flow.html"><i class="fas fa-project-diagram me-2"></i>多信号流图构建</a>
                    <a class="nav-link active" href="fault-diagnosis.html"><i class="fas fa-search me-2"></i>故障诊断与定位</a>
                </nav>
            </div>

            <!-- 主要内容区域 -->
            <div class="col-md-10 main-content">
                <h2 class="mb-4"><i class="fas fa-search me-2"></i>故障诊断与定位</h2>
                <ul class="nav nav-tabs mt-4" id="diagnosisTabs">
                    <li class="nav-item">
                        <a class="nav-link active" data-bs-toggle="tab" href="#data-analysis"><i
                                class="fas fa-chart-line me-2"></i>数据分析</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" data-bs-toggle="tab" href="#fault-diagnosis"><i
                                class="fas fa-stethoscope me-2"></i>故障诊断</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" data-bs-toggle="tab" href="#result-visualization"><i
                                class="fas fa-chart-pie me-2"></i>结果可视化</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" data-bs-toggle="tab" href="#expert-feedback"><i
                                class="fas fa-comment-dots me-2"></i>专家反馈</a>
                    </li>
                </ul>

                <div class="tab-content mt-4">
                    <div id="data-analysis" class="tab-pane active">
                        <div class="row">
                            <div class="col-md-8">
                                <div class="card">
                                    <div class="card-header d-flex justify-content-between align-items-center">
                                        <span><i class="fas fa-chart-line me-2"></i>异常检测</span>
                                        <div>
                                            <button class="btn btn-sm btn-outline-primary me-2"><i
                                                    class="fas fa-play me-1"></i>开始检测</button>
                                            <button class="btn btn-sm btn-outline-secondary"><i
                                                    class="fas fa-file-export me-1"></i>导出报告</button>
                                        </div>
                                    </div>
                                    <div class="card-body">
                                        <div class="diagnosis-chart">
                                            <p class="text-muted">异常检测结果可视化<br>（显示各测点的异常情况）</p>
                                        </div>
                                        <div class="table-responsive">
                                            <table class="table table-bordered">
                                                <thead>
                                                    <tr>
                                                        <th>测点</th>
                                                        <th>状态</th>
                                                        <th>异常程度</th>
                                                        <th>检测时间</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <tr>
                                                        <td>温度传感器1</td>
                                                        <td><span class="badge bg-danger status-badge">异常</span></td>
                                                        <td>严重</td>
                                                        <td>2024-03-20 14:30:00</td>
                                                    </tr>
                                                    <tr>
                                                        <td>压力传感器2</td>
                                                        <td><span class="badge bg-warning status-badge">可疑</span></td>
                                                        <td>中等</td>
                                                        <td>2024-03-20 14:30:00</td>
                                                    </tr>
                                                    <tr>
                                                        <td>振动传感器3</td>
                                                        <td><span class="badge bg-success status-badge">正常</span></td>
                                                        <td>-</td>
                                                        <td>2024-03-20 14:30:00</td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="card">
                                    <div class="card-header"><i class="fas fa-cog me-2"></i>检测参数设置</div>
                                    <div class="card-body">
                                        <form>
                                            <div class="mb-3">
                                                <label class="form-label">检测算法</label>
                                                <select class="form-select">
                                                    <option>基于统计的异常检测</option>
                                                    <option>基于机器学习的异常检测</option>
                                                    <option>基于规则的异常检测</option>
                                                </select>
                                            </div>
                                            <div class="mb-3">
                                                <label class="form-label">时间窗口</label>
                                                <input type="number" class="form-control" value="60">
                                                <div class="form-text text-muted">单位：分钟</div>
                                            </div>
                                            <div class="mb-3">
                                                <label class="form-label">异常阈值</label>
                                                <input type="number" class="form-control" value="3">
                                                <div class="form-text text-muted">标准差倍数</div>
                                            </div>
                                            <div class="mb-3">
                                                <label class="form-label">数据预处理</label>
                                                <div class="form-check">
                                                    <input class="form-check-input" type="checkbox" id="preprocess1">
                                                    <label class="form-check-label" for="preprocess1">去噪</label>
                                                </div>
                                                <div class="form-check">
                                                    <input class="form-check-input" type="checkbox" id="preprocess2">
                                                    <label class="form-check-label" for="preprocess2">归一化</label>
                                                </div>
                                            </div>
                                            <button type="submit" class="btn btn-primary w-100"><i
                                                    class="fas fa-check me-1"></i>应用设置</button>
                                        </form>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div id="fault-diagnosis" class="tab-pane">
                        <div class="row">
                            <div class="col-md-8">
                                <div class="card">
                                    <div class="card-header d-flex justify-content-between align-items-center">
                                        <span><i class="fas fa-stethoscope me-2"></i>故障诊断</span>
                                        <div>
                                            <button class="btn btn-sm btn-outline-primary me-2"><i
                                                    class="fas fa-play me-1"></i>开始诊断</button>
                                            <button class="btn btn-sm btn-outline-secondary"><i
                                                    class="fas fa-file-export me-1"></i>导出报告</button>
                                        </div>
                                    </div>
                                    <div class="card-body">
                                        <div class="diagnosis-chart">
                                            <p class="text-muted">故障诊断结果可视化<br>（显示故障传播路径）</p>
                                        </div>
                                        <div class="table-responsive">
                                            <table class="table table-bordered">
                                                <thead>
                                                    <tr>
                                                        <th>故障类型</th>
                                                        <th>可能原因</th>
                                                        <th>置信度</th>
                                                        <th>建议措施</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <tr>
                                                        <td>温度过高</td>
                                                        <td>冷却系统故障</td>
                                                        <td>85%</td>
                                                        <td>检查冷却液循环</td>
                                                    </tr>
                                                    <tr>
                                                        <td>压力异常</td>
                                                        <td>密封件损坏</td>
                                                        <td>75%</td>
                                                        <td>更换密封件</td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="card">
                                    <div class="card-header"><i class="fas fa-cog me-2"></i>诊断参数设置</div>
                                    <div class="card-body">
                                        <form>
                                            <div class="mb-3">
                                                <label class="form-label">诊断算法</label>
                                                <select class="form-select">
                                                    <option>TeamsRT算法</option>
                                                    <option>基于规则的诊断</option>
                                                    <option>基于贝叶斯的诊断</option>
                                                </select>
                                            </div>
                                            <div class="mb-3">
                                                <label class="form-label">置信度阈值</label>
                                                <input type="number" class="form-control" value="70">
                                                <div class="form-text text-muted">百分比</div>
                                            </div>
                                            <div class="mb-3">
                                                <label class="form-label">诊断深度</label>
                                                <select class="form-select">
                                                    <option>单层诊断</option>
                                                    <option>多层诊断</option>
                                                    <option>完整诊断</option>
                                                </select>
                                            </div>
                                            <button type="submit" class="btn btn-primary w-100"><i
                                                    class="fas fa-check me-1"></i>应用设置</button>
                                        </form>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div id="result-visualization" class="tab-pane">
                        <div class="row">
                            <div class="col-md-8">
                                <div class="card">
                                    <div class="card-header"><i class="fas fa-chart-pie me-2"></i>诊断结果可视化</div>
                                    <div class="card-body">
                                        <div class="diagnosis-chart">
                                            <p class="text-muted">诊断结果可视化<br>（显示故障定位和传播路径）</p>
                                        </div>
                                        <div class="row mt-3">
                                            <div class="col-md-4">
                                                <div class="card">
                                                    <div class="card-body text-center">
                                                        <h5>确定故障</h5>
                                                        <span class="badge bg-danger status-badge">2个</span>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="col-md-4">
                                                <div class="card">
                                                    <div class="card-body text-center">
                                                        <h5>可疑故障</h5>
                                                        <span class="badge bg-warning status-badge">1个</span>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="col-md-4">
                                                <div class="card">
                                                    <div class="card-body text-center">
                                                        <h5>正常部件</h5>
                                                        <span class="badge bg-success status-badge">8个</span>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="card">
                                    <div class="card-header"><i class="fas fa-file-alt me-2"></i>诊断报告</div>
                                    <div class="card-body">
                                        <div class="mb-3">
                                            <h6>诊断摘要</h6>
                                            <p class="text-muted">系统检测到2个确定故障和1个可疑故障，主要涉及冷却系统和密封件。</p>
                                        </div>
                                        <div class="mb-3">
                                            <h6>建议措施</h6>
                                            <ul class="list-group">
                                                <li class="list-group-item">检查冷却系统</li>
                                                <li class="list-group-item">更换密封件</li>
                                                <li class="list-group-item">监控压力变化</li>
                                            </ul>
                                        </div>
                                        <div class="mb-3">
                                            <h6>诊断时间</h6>
                                            <p class="text-muted">2024-03-20 14:35:00</p>
                                        </div>
                                        <button class="btn btn-primary w-100"><i
                                                class="fas fa-file-export me-1"></i>导出完整报告</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div id="expert-feedback" class="tab-pane">
                        <div class="row">
                            <div class="col-md-6">
                                <div class="card">
                                    <div class="card-header"><i class="fas fa-comment-dots me-2"></i>专家反馈</div>
                                    <div class="card-body">
                                        <form>
                                            <div class="mb-3">
                                                <label class="form-label">诊断结果评估</label>
                                                <select class="form-select">
                                                    <option>完全正确</option>
                                                    <option>部分正确</option>
                                                    <option>需要修正</option>
                                                </select>
                                            </div>
                                            <div class="mb-3">
                                                <label class="form-label">修正建议</label>
                                                <textarea class="form-control" rows="3"></textarea>
                                            </div>
                                            <div class="mb-3">
                                                <label class="form-label">补充信息</label>
                                                <textarea class="form-control" rows="3"></textarea>
                                            </div>
                                            <button type="submit" class="btn btn-primary"><i
                                                    class="fas fa-paper-plane me-1"></i>提交反馈</button>
                                        </form>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="card">
                                    <div class="card-header"><i class="fas fa-history me-2"></i>历史反馈记录</div>
                                    <div class="card-body">
                                        <div class="list-group">
                                            <div class="list-group-item">
                                                <div class="d-flex w-100 justify-content-between">
                                                    <h6 class="mb-1">反馈 #001</h6>
                                                    <small>2024-03-19</small>
                                                </div>
                                                <p class="mb-1">诊断结果准确，建议措施有效。</p>
                                            </div>
                                            <div class="list-group-item">
                                                <div class="d-flex w-100 justify-content-between">
                                                    <h6 class="mb-1">反馈 #002</h6>
                                                    <small>2024-03-18</small>
                                                </div>
                                                <p class="mb-1">需要补充考虑环境因素的影响。</p>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Bootstrap JS -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
    <script>
        // 选项卡切换功能
        document.addEventListener('DOMContentLoaded', function () {
            const tabLinks = document.querySelectorAll('#diagnosisTabs .nav-link');
            const tabContents = document.querySelectorAll('.tab-pane');

            tabLinks.forEach(link => {
                link.addEventListener('click', function (e) {
                    e.preventDefault();

                    // 移除所有active类
                    tabLinks.forEach(tab => {
                        tab.classList.remove('active');
                    });

                    // 隐藏所有选项卡内容
                    tabContents.forEach(content => {
                        content.classList.remove('active');
                    });

                    // 激活当前点击的选项卡
                    this.classList.add('active');

                    // 显示对应的内容
                    const tabId = this.getAttribute('href');
                    document.querySelector(tabId).classList.add('active');
                });
            });
        });
    </script>
</body>

</html>